import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/vant.js'
import './assets/font/iconfont.css'
// 引入全局样式
import './assets/css/global.css'
import axios from 'axios'
import VueAMap from 'vue-amap'
import moment from 'moment'
import Nprogress from 'nprogress'
import 'nprogress/nprogress.css'

Vue.use(VueAMap)
VueAMap.initAMapApiLoader({
  key: '929b6eb96f52f2a4e645a71d2ec65a58',
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  // 默认高德 sdk 版本为 1.4.4
  v: '1.4.4'
})

axios.defaults.baseURL = 'http://www.liulongbin.top:3005'
//拦截请求，添加Authorization
axios.interceptors.request.use(config=>{
  Nprogress.start();
  return config;
})
axios.interceptors.response.use(config=>{
  Nprogress.done();
  return config;
})

Vue.prototype.$axios = axios
Vue.config.productionTip = false

// 添加全局过滤器
Vue.filter('formatData', (val) => {
  return moment(val).format('YYYY-MM-DD')
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
